rendernodepaintable: Don't try to snapshot 0×0 nodes
authorTimm Bäder <mail@baedert.org>
Sun, 13 Jan 2019 06:23:10 +0000 (07:23 +0100)
committerTimm Bäder <mail@baedert.org>
Sun, 13 Jan 2019 07:39:05 +0000 (08:39 +0100)
Considering the operations that some of the rendernode constructors
do, nodes with width or height 0 (or both of course) are very well
possible. This would break in the rendernodepaintable when adding a
transform, which divides by width/height of the rendernode.

gtk/gtkrendernodepaintable.c

index 7ee40b138ba8473c4f2e3da7c0c68cff2498b4b2..8e67150a375845bd40a99240a2c3b2621bed942d 100644 (file)
@@ -45,6 +45,10 @@ gtk_render_node_paintable_paintable_snapshot (GdkPaintable *paintable,
   GtkRenderNodePaintable *self = GTK_RENDER_NODE_PAINTABLE (paintable);
   gboolean needs_transform;
 
+  if (self->bounds.size.width <= 0 ||
+      self->bounds.size.height <= 0)
+    return;
+
   needs_transform = self->bounds.size.width != width ||
                     self->bounds.size.height != height;